<?php

	if ($_SESSION['Level'] == "HRD")
	{
		// Mengambil data karyawan yang akam di edit
		$IdKaryawan = $_GET['IdKaryawan'];
		
		// Menampilkan data Karyawan
		$DataKaryawan = mysql_query("SELECT * FROM d_karyawan WHERE id_karyawan = '$IdKaryawan'");
		$Data = mysql_fetch_array($DataKaryawan);

		// mengambil variabel dari tabel karyawan
		$Tlc = $Data['tlc'];
		$NamaLengkap = $Data['nama_lengkap'];
		$NamaPanggilan = $Data['nama_panggilan'];
		$NIP = $Data['NIP'];
		$Jabatan = $Data['jabatan'];
		$UnitKerja = $Data['unit_kerja'];
		$JatahCuti = $Data['jatah_cuti'];
		$IdKaryawan = $Data['id_karyawan'];
		$TglMasukKerja = $Data['tgl_masuk_kerja'];
		$JatahCuti = $Data['jatah_cuti'];
		$Level = $Data['level'];
		$Email = $Data['email'];
		$Alamat = $Data['alamat'];
		$NoTelepon = $Data['no_tlp'];
		
				echo "		<form method=post action=proses.php>
							<table border=2 cellpadding=10>							
							<tr>
							<td colspan=2 align='center' ><h1>Update Data Karyawan</h1></td>
							</tr>							
							<tr>
							<td>Nama Lengkap</td>
							<td><input type='text' size=32 name='NamaLengkap' value='$NamaLengkap' ></td>
							</tr>
							<tr>
							<td>Nama Panggilan</td>
							<td><input type='text' size=32 name='NamaPanggilan' value='$NamaPanggilan' ></td>
							</tr>
							<tr>
							<td>NIP</td>
							<td><input type='text' size=32 name='NIP' value='$NIP' ></td>
							</tr>							
							<tr>
							<td>Jabatan</td>
							<td><input type='text' size=32 name='Jabatan' value='$Jabatan' ></td>
							</tr>							
							<tr>
							<td>Unit Kerja</td>
							<td><input type='text' size=32 name='UnitKerja' value='$UnitKerja' ></td>
							</tr>							
							<tr>
							<td>Tlc</td>
							<td><input type='text' size=32 name='Tlc' value='$Tlc' ></td>
							</tr>							
							<tr>
							<td>Tanggal Msuk kerja</td>
							<td>$TglMasukKerja</td>
							</tr>							
							<tr>
							<td>Jatah Cuti</td>
							<td><input type='text' size=32 name='JatahCuti' value='$JatahCuti' ></td>
							</tr>							
							<tr>
							<td>Level</td>
							<td><select name='Level'>";
							$Level = array('Karyawan'  ,'HRD' , 'Direktur');
							for($i=0;$i<=2;$i++)
							{
							echo "<option value='$Level[$i]'";
							if($Level[$i] ==  $Data['level'])
							echo "selected";
							echo">$Level[$i]</option>";
							}
							
					echo	"
							</select>
							</td>
							</tr>							
							<tr>
							<td>Email</td>
							<td><input type='text' size=32 name='Email' value='$Email' ></td>
							</tr>
							<tr>
							<td>Alamat</td> 
							<td><input type='text' size=32 name='Alamat' value='$Alamat' ></td>
							</tr>
							<tr>
							<td>No Telepon</td>
							<td><input type='text' size=32 name='NoTelepon' value='$NoTelepon' ></td>
							</tr>
							<tr>
							<td colspan=2 align='center'>
								<input type='hidden' size=32 name='IdKaryawan' value='$IdKaryawan' >
								<input type='submit' name='UpdateDataUser' value='Update'></td>
							</tr>							
							</table>
							</form>";
}
?>